import {
    Controller,
    Get,
    Param,
    Inject,
  } from '@midwayjs/core';
  import { Context } from '@midwayjs/koa';
  import { ApiTags } from '@midwayjs/swagger';
  import { PromiseService } from '../service/promise.service';
  
  @ApiTags(['Promise Management'])
  @Controller('/promise')
  export class PromiseController {
    @Inject()
    ctx: Context;
  
    @Inject()
    promiseService: PromiseService;
  
    @Get('/trigger/:id', { summary: 'Trigger promise resolution by ID' })
    async trigger(@Param('id') id: string) {
      this.promiseService.resolvePromise(id);
      return { message: `Promise with id ${id} resolved` };
    }
  }